package com.s.core.root.strategy.factor.point;

import com.s.core.root.data._AllData;
import com.s.core.root.data._PicN;
import com.s.core.root.data._PointN;
import com.s.core.root.strategy.base.Factor;
import com.s.core.root.strategy.base.Feature;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.List;

/**
 * Point特征：描述是最后一个Point
 */
@AllArgsConstructor
@Data
public class F_Point_Last implements Factor, Feature {

    @Override
    public void process(_AllData allData) {
        for (_PicN picN : allData.picNMap.values()) {
            process(picN.getPointNList1());
            process(picN.getPointNList2());
        }
    }

    private void process(List<_PointN> pointNList) {
        if (pointNList.isEmpty()) {
            return;
        }
        _PointN lastPoint = pointNList.get(pointNList.size() - 1);
        lastPoint.addFeature(new F_Point_Last());
    }
}
